home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
Shareware World
/
Info
/
For Developers
/
Mops 3.4.sea
/
Mops source
/
Module source
/
zUtilmod.txt
< prev
next >
Wrap
Text File
|
1997-11-10
|
2KB
|
94 lines
\ Various utilities
: CHK
ResError ?dup
IF 3 beep 3 beep cr
dup -48 =
IF ." You can't save using the same name as the running" cr
." application. Please try again with a different name." cr
ELSE
." Res error# " . cr
THEN
QUIT
THEN ;
\ Class RES+ adds methods to Resource to allow various modifications
\ to resources. We'll put more in as we need them.
:class RES+ super{ resource }
objPtr TEMPRES class_is res+
:m CHANGED: get: self ChangedResource ;m
:m ADD: { addr len -- }
get: self
get: resType get: ID
addr len >str255 AddResource chk ;m
:m REMOVE:
get: self RemoveResource chk ;m
:m SETATTRS: \ ( n -- )
get: self swap SetResAttrs chk
changed: self ;m
;class
string TEMP$
res+ TEMPRES
: (.MOD) { theCfa dummy \ modObj -- }
theCfa mod? NIF drop EXIT THEN
>obj -> modObj
cr 0 -> out .id: [ modObj ]
15 out - spaces
print: [ modObj ]
;
\ base: [ modObj ] dup
\ NIF drop ." not loaded" ELSE u.h THEN
\ keep?: [ modObj ] IF type# 174 ( *** Keep *** ) THEN
\ locked?: [ modObj ] IF type# 175 ( *** Locked *** ) THEN ;
: .MODS \ Lists modules and their load status.
['] (.mod) 0 trav
cr ;
: .MSGS \ Lists all error etc. messages and their numbers.
300 -60 DO
?pause cr
i . space i getstring
dup IF type ELSE 2drop THEN
LOOP ;
: ADDMSG { msg# addr len -- }
msg# getstring abort" number already assigned" drop
addr pad 1+ len cmove
len pad c!
new: temp$
pad len 1+ put: temp$
'type STR msg# set: tempRes handle: temp$ put: tempRes
0 0 add: tempRes
$ 20 setAttrs: tempRes ;
: REMOVEMSG { msg# -- }
msg# getstring nip 0EXIT
'type STR msg# set: tempRes getnew: tempRes
remove: tempRes release: tempRes ;
: GETINDSTR { resID idx \ addr -- addr len }
openMR
'type STR# resID getRes dup NIF 0 EXIT THEN
( handle ) @ -> addr
idx addr w@ >= IF 0 0 EXIT THEN
2 ++> addr
idx 0 ?DO addr count + -> addr LOOP
addr count ;